﻿using System;
using System.Data;

namespace Credits
{
    public class DataObjects
    {

        [Serializable]
        public class Client
        {
            int mClientID = 0;
            bool mAllowDelete = false;
            string mFirstName = string.Empty;
            string mLastName = string.Empty;
            DateTime mBirthDate = DateTime.MinValue;
            string mPlaceOfBirth = string.Empty;
            string mClientPersonalFolder = string.Empty;
            string mClientPersonalID = string.Empty;
            int mGender = 0;
            string mGender_String = string.Empty;
            string mBuletinSeria = string.Empty;
            DateTime mDataEliberariiBuletin = DateTime.MinValue;
            DateTime mDataExpirariiBuletin = DateTime.MinValue;
            string mBuletinEliberatDe = string.Empty;
            int mCivilStatus = 0;
            string mCivilStatus_String = string.Empty;
            int mChurch = 0;
            string mChurch_String = string.Empty;
            int mNumberOfChildren = 0;
            int mSocialStatus = 0;
            string mSocialStatus_String = string.Empty;
            int mStudyLevel = 0;
            string mStudyLevel_String = string.Empty;
            string mImageURL = string.Empty;
            string mTelefonFix = string.Empty;
            string mTelefonMobil = string.Empty;
            string mTelefonMobil2 = string.Empty;
            int mViza_Country = 0;
            string mViza_Country_String = string.Empty;
            int mViza_Raion = 0;
            string mViza_Raion_String = string.Empty;
            string mViza_UrbanRural = string.Empty;
            string mViza_Localitatea = string.Empty;
            string mViza_StradaAdresa = string.Empty;
            int mRaddress_Country = 0;
            string mRaddress_Country_String = string.Empty;
            int mRaddress_Raion = 0;
            string mRaddress_Raion_String = string.Empty;
            string mRaddress_UrbanRural = string.Empty;
            string mRaddress_Localitatea = string.Empty;
            string mRaddress_StradaAdresa = string.Empty;
            string mEmail = string.Empty;
            int mVenitFamInceputAfacere = 0;
            int mNrPersoaneIntretinere = 0;
            int mSituatiaMateriala = 0;
            string mSituatiaMateriala_String = string.Empty;
            string mSlujireInBiserica = string.Empty;
            string mPastorLider = string.Empty;
            string mTelefonPastor = string.Empty;
            int mBank_id = 0;
            string mBankName = string.Empty;
            string mContBancar = string.Empty;
            string mBank_IBAN = string.Empty;
            string mHusbandFullName = string.Empty;
            int mHusbandID = 0;
            string mSortGroup_String = string.Empty;
            int mSortGroup = 0;


            public int ClientID
            {
                get { return mClientID; }
                set { mClientID = value; }
            }

            public bool AllowDelete
            {
                get { return mAllowDelete; }
            }

            public string FirstName
            {
                get { return mFirstName; }
                set { mFirstName = value; }
            }

            public string LastName
            {
                get { return mLastName; }
                set { mLastName = value; }
            }

            public DateTime BirthDate
            {
                get { return mBirthDate; }
                set { mBirthDate = value; }
            }

            public string HusbandFullName
            {
                get { return mHusbandFullName; }
                set { mHusbandFullName = value; }
            }

            public int HusbandID
            {
                get { return mHusbandID; }
                set { mHusbandID = value; }
            }

            public string PlaceOfBirth
            {
                get { return mPlaceOfBirth; }
                set { mPlaceOfBirth = value; }
            }

            public string PersonalID
            {
                get { return mClientPersonalID; }
                set { mClientPersonalID = value; }
            }

            public int Gender
            {
                get { return mGender; }
                set { mGender = value; }
            }

            public string Gender_String
            {
                get { return mGender_String; }
                set { mGender_String = value; }
            }

            public string BuletinSeria
            {
                get { return mBuletinSeria; }
                set { mBuletinSeria = value; }
            }

            public DateTime DataEliberariiBuletin
            {
                get { return mDataEliberariiBuletin; }
                set { mDataEliberariiBuletin = value; }
            }

            public DateTime DataExpirariiBuletin
            {
                get { return mDataExpirariiBuletin; }
                set { mDataExpirariiBuletin = value; }
            }
            public string BuletinEliberatDe
            {
                get { return mBuletinEliberatDe; }
                set { mBuletinEliberatDe = value; }
            }

            public int CivilStatus
            {
                get { return mCivilStatus; }
                set { mCivilStatus = value; }
            }

            public string CivilStatus_String
            {
                get { return mCivilStatus_String; }
                set { mCivilStatus_String = value; }
            }

            public int Church
            {
                get { return mChurch; }
                set { mChurch = value; }
            }

            public string Church_String
            {
                get { return mChurch_String; }
                set { mChurch_String = value; }
            }

            public int NumberOfChildren
            {
                get { return mNumberOfChildren; }
                set { mNumberOfChildren = value; }
            }

            public int SocialStatus
            {
                get { return mSocialStatus; }
                set { mSocialStatus = value; }
            }

            public string SocialStatus_String
            {
                get { return mSocialStatus_String; }
                set { mSocialStatus_String = value; }
            }

            public int StudyLevel
            {
                get { return mStudyLevel; }
                set { mStudyLevel = value; }
            }

            public string StudyLevel_String
            {
                get { return mStudyLevel_String; }
                set { mStudyLevel_String = value; }
            }

            public string ImageURL
            {
                get { return mImageURL; }
                set { mImageURL = value; }
            }

            public string TelefonFix
            {
                get { return mTelefonFix; }
                set { mTelefonFix = value; }
            }

            public string TelefonMobil
            {
                get { return mTelefonMobil; }
                set { mTelefonMobil = value; }
            }

            public string TelefonMobil2
            {
                get { return mTelefonMobil2; }
                set { mTelefonMobil2 = value; }
            }

            public int Viza_Country
            {
                get { return mViza_Country; }
                set { mViza_Country = value; }
            }

            public string Viza_Country_String
            {
                get { return mViza_Country_String; }
                set { mViza_Country_String = value; }
            }

            public int Viza_Raion
            {
                get { return mViza_Raion; }
                set { mViza_Raion = value; }
            }

            public string Viza_Raion_String
            {
                get { return mViza_Raion_String; }
                set { mViza_Raion_String = value; }
            }

            public string Viza_UrbanRural
            {
                get { return mViza_UrbanRural; }
                set { mViza_UrbanRural = value; }
            }

            public string Viza_Localitatea
            {
                get { return mViza_Localitatea; }
                set { mViza_Localitatea = value; }
            }

            public string Viza_StradaAdresa
            {
                get { return mViza_StradaAdresa; }
                set { mViza_StradaAdresa = value; }
            }

            public int Raddress_Country
            {
                get { return mRaddress_Country; }
                set { mRaddress_Country = value; }
            }

            public string Raddress_Country_String
            {
                get { return mRaddress_Country_String; }
                set { mRaddress_Country_String = value; }
            }

            public int Raddress_Raion
            {
                get { return mRaddress_Raion; }
                set { mRaddress_Raion = value; }
            }

            public string Raddress_Raion_String
            {
                get { return mRaddress_Raion_String; }
                set { mRaddress_Raion_String = value; }
            }

            public string Raddress_UrbanRural
            {
                get { return mRaddress_UrbanRural; }
                set { mRaddress_UrbanRural = value; }
            }

            public string Raddress_Localitatea
            {
                get { return mRaddress_Localitatea; }
                set { mRaddress_Localitatea = value; }
            }

            public string Raddress_StradaAdresa
            {
                get { return mRaddress_StradaAdresa; }
                set { mRaddress_StradaAdresa = value; }
            }

            public string Email
            {
                get { return mEmail; }
                set { mEmail = value; }
            }

            public int VenitFamInceputAfacere
            {
                get { return mVenitFamInceputAfacere; }
                set { mVenitFamInceputAfacere = value; }
            }

            public int NrPersoaneIntretinere
            {
                get { return mNrPersoaneIntretinere; }
                set { mNrPersoaneIntretinere = value; }
            }

            public int SituatiaMateriala
            {
                get { return mSituatiaMateriala; }
                set { mSituatiaMateriala = value; }
            }

            public string SituatiaMateriala_String
            {
                get { return mSituatiaMateriala_String; }
                set { mSituatiaMateriala_String = value; }
            }

            public string SlujireInBiserica
            {
                get { return mSlujireInBiserica; }
                set { mSlujireInBiserica = value; }
            }

            public string PastorLider
            {
                get { return mPastorLider; }
                set { mPastorLider = value; }
            }

            public string TelefonPastor
            {
                get { return mTelefonPastor; }
                set { mTelefonPastor = value; }
            }

            public string ClientPersonalFolder
            {
                get { return mClientPersonalFolder.Equals(string.Empty) ? mClientID.ToString() : mClientPersonalFolder; }
                set { mClientPersonalFolder = value; }
            }

            public int Bank_id
            {
                get { return mBank_id; }
                set { mBank_id = value; }
            }

            public string BankName
            {
                get { return mBankName; }
                set { mBankName = value; }
            }

            public string ContBancar
            {
                get { return mContBancar; }
                set { mContBancar = value; }
            }

            public string Bank_IBAN
            {
                get { return mBank_IBAN; }
                set { mBank_IBAN = value; }
            }


            public string SortGroup_String
            {
                get { return mSortGroup_String; }
                set { mSortGroup_String = value; }
            }

            public int SortGroup
            {
                get { return mSortGroup; }
                set { mSortGroup = value; }
            }

            DateTime mActivationDate = DateTime.MinValue;
            public DateTime ActivationDate
            {
                get { return mActivationDate; }
                set { mActivationDate = value; }
            }

            string mLastManager = string.Empty;
            public string LastManager
            {
                get { return mLastManager; }
                set { mLastManager = value; }
            }

            int mTotalLoansNumber = 0;
            public int TotalLoansNumber
            {
                get { return mTotalLoansNumber; }
                set { mTotalLoansNumber = value; }
            }

            decimal mLastLoanAmount = 0;
            public decimal LastLoanAmount
            {
                get { return mLastLoanAmount; }
                set { mLastLoanAmount = value; }
            }

            int mActiveLoans = 0;
            public int ActiveLoans
            {
                get { return mActiveLoans; }
                set { mActiveLoans = value; }
            }

            decimal mTotalProfits = 0;
            public decimal TotalProfits
            {
                get { return mTotalProfits; }
                set { mTotalProfits = value; }
            }

            decimal mActiveProfits = 0;
            public decimal ActiveProfits
            {
                get { return mActiveProfits; }
                set { mActiveProfits = value; }
            }

            public Client()
            {
            }

            public Client(DataRow clientInfoRow)
            {
                if (clientInfoRow != null)
                {
                    mClientID = clientInfoRow["clientID"] != System.DBNull.Value ? (int)clientInfoRow["clientID"] : 0;
                    mAllowDelete = clientInfoRow["AllowDelete"] != System.DBNull.Value ? (bool)clientInfoRow["AllowDelete"] : false;
                    mFirstName = clientInfoRow["FirstName"] != System.DBNull.Value ? (string)clientInfoRow["FirstName"] : string.Empty;
                    mLastName = clientInfoRow["LastName"] != System.DBNull.Value ? (string)clientInfoRow["LastName"] : string.Empty;
                    mBirthDate = clientInfoRow["DateOfBirth"] != System.DBNull.Value ? (DateTime)clientInfoRow["DateOfBirth"] : DateTime.MinValue;
                    mPlaceOfBirth = clientInfoRow["PlaceOfBirth"] != System.DBNull.Value ? (string)clientInfoRow["PlaceOfBirth"] : string.Empty;
                    mClientPersonalID = clientInfoRow["personalID"] != System.DBNull.Value ? (string)clientInfoRow["personalID"] : string.Empty;
                    mGender = clientInfoRow["gender"] != System.DBNull.Value ? (int)clientInfoRow["gender"] : 0;
                    mGender_String = clientInfoRow["gender_string"] != System.DBNull.Value ? (string)clientInfoRow["gender_string"] : string.Empty;
                    mBuletinSeria = clientInfoRow["buletinSeria"] != System.DBNull.Value ? (string)clientInfoRow["buletinSeria"] : string.Empty;
                    mDataEliberariiBuletin = clientInfoRow["dataEliberarii"] != System.DBNull.Value ? (DateTime)clientInfoRow["dataEliberarii"] : DateTime.MinValue;
                    mDataExpirariiBuletin = clientInfoRow["dataExpirarii"] != System.DBNull.Value ? (DateTime)clientInfoRow["dataExpirarii"] : DateTime.MinValue;
                    mBuletinEliberatDe = clientInfoRow["eliberatDe"] != System.DBNull.Value ? (string)clientInfoRow["eliberatDe"] : string.Empty;
                    mCivilStatus = clientInfoRow["civilStatus"] != System.DBNull.Value ? (int)clientInfoRow["civilStatus"] : 0;
                    mCivilStatus_String = clientInfoRow["CivilStatus_String"] != System.DBNull.Value ? (string)clientInfoRow["CivilStatus_String"] : string.Empty;
                    mChurch = clientInfoRow["church"] != System.DBNull.Value ? (int)clientInfoRow["church"] : 0;
                    mChurch_String = clientInfoRow["church_String"] != System.DBNull.Value ? (string)clientInfoRow["church_String"] : string.Empty;
                    mNumberOfChildren = clientInfoRow["numberOfChildren"] != System.DBNull.Value ? (int)clientInfoRow["numberOfChildren"] : 0;
                    mSocialStatus = clientInfoRow["socialStatus"] != System.DBNull.Value ? (int)clientInfoRow["socialStatus"] : 0;
                    mSocialStatus_String = clientInfoRow["socialStatus_String"] != System.DBNull.Value ? (string)clientInfoRow["socialStatus_String"] : string.Empty;
                    mStudyLevel = clientInfoRow["studyLevel"] != System.DBNull.Value ? (int)clientInfoRow["studyLevel"] : 0;
                    mStudyLevel_String = clientInfoRow["studyLevel_String"] != System.DBNull.Value ? (string)clientInfoRow["studyLevel_String"] : string.Empty;
                    mImageURL = clientInfoRow["imageURL"] != System.DBNull.Value ? (string)clientInfoRow["imageURL"] : string.Empty;
                    mTelefonFix = clientInfoRow["telefonFix"] != System.DBNull.Value ? (string)clientInfoRow["telefonFix"] : string.Empty;
                    mTelefonMobil = clientInfoRow["telefonMobil"] != System.DBNull.Value ? (string)clientInfoRow["telefonMobil"] : string.Empty;
                    mTelefonMobil2 = clientInfoRow["telefonMobil2"] != System.DBNull.Value ? (string)clientInfoRow["telefonMobil2"] : string.Empty;
                    mViza_Country = clientInfoRow["viza_country"] != System.DBNull.Value ? (int)clientInfoRow["viza_country"] : 0;
                    mViza_Country_String = clientInfoRow["viza_country_string"] != System.DBNull.Value ? (string)clientInfoRow["viza_country_string"] : string.Empty;
                    mViza_Raion = clientInfoRow["viza_raion"] != System.DBNull.Value ? (int)clientInfoRow["viza_raion"] : 0;
                    mViza_Raion_String = clientInfoRow["viza_raion_string"] != System.DBNull.Value ? (string)clientInfoRow["viza_raion_string"] : string.Empty;
                    mViza_UrbanRural = clientInfoRow["viza_urbanRural"] != System.DBNull.Value ? (string)clientInfoRow["viza_urbanRural"] : string.Empty;
                    mViza_Localitatea = clientInfoRow["viza_localitatea"] != System.DBNull.Value ? (string)clientInfoRow["viza_localitatea"] : string.Empty;
                    mViza_StradaAdresa = clientInfoRow["viza_stradaAdresa"] != System.DBNull.Value ? (string)clientInfoRow["viza_stradaAdresa"] : string.Empty;
                    mRaddress_Country = clientInfoRow["Raddress_country"] != System.DBNull.Value ? (int)clientInfoRow["Raddress_country"] : 0;
                    mRaddress_Country_String = clientInfoRow["Raddress_country_string"] != System.DBNull.Value ? (string)clientInfoRow["Raddress_country_string"] : string.Empty;
                    mRaddress_Raion = clientInfoRow["Raddress_raion"] != System.DBNull.Value ? (int)clientInfoRow["Raddress_raion"] : 0;
                    mRaddress_Raion_String = clientInfoRow["Raddress_raion_string"] != System.DBNull.Value ? (string)clientInfoRow["Raddress_raion_string"] : string.Empty;
                    mRaddress_UrbanRural = clientInfoRow["Raddress_urbanRural"] != System.DBNull.Value ? (string)clientInfoRow["Raddress_urbanRural"] : string.Empty;
                    mRaddress_Localitatea = clientInfoRow["Raddress_localitatea"] != System.DBNull.Value ? (string)clientInfoRow["Raddress_localitatea"] : string.Empty;
                    mRaddress_StradaAdresa = clientInfoRow["Raddress_stradaAdresa"] != System.DBNull.Value ? (string)clientInfoRow["Raddress_stradaAdresa"] : string.Empty;
                    mEmail = clientInfoRow["email"] != System.DBNull.Value ? (string)clientInfoRow["email"] : string.Empty;
                    mVenitFamInceputAfacere = clientInfoRow["venitFamInceputAfacere"] != System.DBNull.Value ? (int)clientInfoRow["venitFamInceputAfacere"] : 0;
                    mNrPersoaneIntretinere = clientInfoRow["nrPersoaneIntretinere"] != System.DBNull.Value ? (int)clientInfoRow["nrPersoaneIntretinere"] : 0;
                    mSituatiaMateriala = clientInfoRow["situatiaMateriala"] != System.DBNull.Value ? (int)clientInfoRow["situatiaMateriala"] : 0;
                    mSituatiaMateriala_String = clientInfoRow["situatiaMateriala_string"] != System.DBNull.Value ? (string)clientInfoRow["situatiaMateriala_string"] : string.Empty;
                    mSlujireInBiserica = clientInfoRow["slujireInBiserica"] != System.DBNull.Value ? (string)clientInfoRow["slujireInBiserica"] : string.Empty;
                    mPastorLider = clientInfoRow["pastorLider"] != System.DBNull.Value ? (string)clientInfoRow["pastorLider"] : string.Empty;
                    mTelefonPastor = clientInfoRow["telefonPastor"] != System.DBNull.Value ? (string)clientInfoRow["telefonPastor"] : string.Empty;
                    mClientPersonalFolder = clientInfoRow["personalfolder"] != System.DBNull.Value ? (string)clientInfoRow["personalfolder"] : mClientID.ToString();
                    mBank_id = clientInfoRow["bank_id"] != System.DBNull.Value ? (int)clientInfoRow["bank_id"] : 0;
                    mBankName = clientInfoRow["BankName"] != System.DBNull.Value ? (string)clientInfoRow["BankName"] : string.Empty;
                    mContBancar = clientInfoRow["contbancar"] != System.DBNull.Value ? (string)clientInfoRow["contbancar"] : string.Empty;
                    mBank_IBAN = clientInfoRow["Bank_IBAN"] != System.DBNull.Value ? (string)clientInfoRow["Bank_IBAN"] : string.Empty;
                    mHusbandID = clientInfoRow["HusbandID"] != System.DBNull.Value ? (int)clientInfoRow["HusbandID"] : 0;
                    mHusbandFullName = clientInfoRow["HusbandFullName"] != System.DBNull.Value ? (string)clientInfoRow["HusbandFullName"] : string.Empty;
                    mSortGroup = clientInfoRow["SortGroup"] != System.DBNull.Value ? (int)clientInfoRow["SortGroup"] : 0;
                    mSortGroup_String = clientInfoRow["SortGroup_String"] != System.DBNull.Value ? (string)clientInfoRow["SortGroup_String"] : string.Empty;
                    mActivationDate = clientInfoRow["ActivationDate"] != System.DBNull.Value ? (DateTime)clientInfoRow["ActivationDate"] : DateTime.MinValue;
                    mLastManager = clientInfoRow["LastManager"] != System.DBNull.Value ? (string)clientInfoRow["LastManager"] : string.Empty;
                    mTotalLoansNumber = clientInfoRow["TotalLoansNumber"] != System.DBNull.Value ? (int)clientInfoRow["TotalLoansNumber"] : 0;
                    mLastLoanAmount = clientInfoRow["LastLoanAmount"] != System.DBNull.Value ? (decimal)clientInfoRow["LastLoanAmount"] : 0;
                    mActiveLoans = clientInfoRow["ActiveLoans"] != System.DBNull.Value ? (int)clientInfoRow["ActiveLoans"] : 0;
                    mTotalProfits = clientInfoRow["TotalProfits"] != System.DBNull.Value ? (decimal)clientInfoRow["TotalProfits"] : 0;
                    mActiveProfits = clientInfoRow["ActiveProfits"] != System.DBNull.Value ? (decimal)clientInfoRow["ActiveProfits"] : 0; 

                }
            }


        }
        
        public class LoanObject
        {
            private int mLoanID = 0;
            private int mLoanVersion = 0;
            private int mLoanProgramID = 0;

            private int mContractCode = 0;
            private DateTime mLoanStartDate = DateTime.MinValue;
            private DateTime mLoanEndDate = DateTime.MinValue;

            private string mClientFirstLastName = string.Empty;
            private string mClientCountry = string.Empty;
            private string mClientRaion = string.Empty;    
            private string mClientLocalitatea = string.Empty;
            private string mClientBuletin = string.Empty;
            private string mBuletinEliberatDe = string.Empty;
            private DateTime mBuletinDataEliberarii = DateTime.MinValue;
            private string mClientPersonalID = string.Empty;
            private DateTime mClientBirthDate = DateTime.MinValue;
            private string mContractAmountInWords = string.Empty;
            private string mBankFullName = string.Empty;
            private string mContBancar = string.Empty;
            private string mCodulBancii = string.Empty;
            private string mClientTelefon = string.Empty;
            private string mContractValutaNameInfinitivInWords = string.Empty;
            private string mContractValutaNameNotInfinitivInWords = string.Empty;

            private decimal mContractAmount = 0;
            private decimal mContractAmountInLei = 0;
            private decimal mContrcatPercent = 0;
            private string mContrcatPercentinWords = string.Empty;
            private string mContractAmountInLeiInWords = string.Empty;
            private decimal mContractPenalty = 0;
            private decimal mCurrencyChangeRate = 0;
            private string mCurrencyChangeRateSimbols = string.Empty;

            private int mClientID = 0;
            private int mCurrencyID = 0;
            private int mModifiedBy = 0;
            private int mLoanCategoryID = 0;
            private int mLoanState = 0;
            private string mLoanStateString = string.Empty;
            private string mCreditFundingLine = string.Empty;
            private int mFundingLineID = 0;
            private int mNrOfCreditMonth = 0;
            private int mCalculatePercentFrom = 0;
            private string mCalculatePercentFromString = string.Empty;
            private string mCalculatePenaltyFromString = string.Empty;
            private int mCalculatePenaltyFrom = 0;
            private int mPenaltyGracePeriod = 0;
            private string mLoanScope = string.Empty;
            private string mLoanCategoryString = string.Empty;
            private string mModifiedByString = string.Empty;
            private string mPayPeriodIDString = string.Empty;            
            private int mPayPeriodID = 0;    

            public LoanObject()
            {
            }

            public int ContractCode
            {
                get { return mContractCode; }
                set { mContractCode = value; }
            }
        
            public int LoanID
            {
                get { return mLoanID; }
                set { mLoanID = value; }
            }

            public int LoanVersion
            {
                get { return mLoanVersion; }
                set { mLoanVersion = value; }
            }

            public int LoanProgramID
            {
                get { return mLoanProgramID; }
                set { mLoanProgramID = value; }
            }

            public int ClientID
            {
                get { return mClientID; }
                set { mClientID = value; }
            }     

            public DateTime LoanStartDate
            {
                get { return mLoanStartDate; }
                set { mLoanStartDate = value; }
            }

            public DateTime LoanEndDate
            {
                get { return mLoanEndDate; }
                set { mLoanEndDate = value; }
            }    

            public string ClientFirstLastName
            {
                get { return mClientFirstLastName; }
                set { mClientFirstLastName = value; }
            }

            public string ClientCountry
            {
                get { return mClientCountry; }
                set { mClientCountry = value; }
            }

            public string ClientRaion
            {
                get { return mClientRaion; }
                set { mClientRaion = value; }
            }

            public string ClientLocalitatea
            {
                get { return mClientLocalitatea; }
                set { mClientLocalitatea = value; }
            }

            string mClientStradaAdresa = string.Empty;
            public string ClientStradaAdresa
            {
                get { return mClientStradaAdresa; }
                set { mClientStradaAdresa = value; }
            }

            public string ClientBuletin
            {
                get { return mClientBuletin; }
                set { mClientBuletin = value; }
            }      

            public string BuletinEliberatDe
            {
                get { return mBuletinEliberatDe; }
                set { mBuletinEliberatDe = value; }
            }

            public DateTime BuletinDataEliberarii
            {
                get { return mBuletinDataEliberarii; }
                set { mBuletinDataEliberarii = value; }
            }

            public string ClientPersonalID
            {
                get { return mClientPersonalID; }
                set { mClientPersonalID = value; }
            }

            public DateTime ClientBirthDate
            {
                get { return mClientBirthDate; }
                set { mClientBirthDate = value; }
            }

            public string ContractSpecificStartDate
            {
                get 
                {
                    return Crypt.Utils.GetDateTimeInSpecialFormat(this.LoanStartDate); 
                }
            }

            public string LoanStartDateInWords
            {
                get
                {
                    return Crypt.Utils.GetDateTimeInFullWordsFormat(this.LoanStartDate);
                }
            }

            public string LoanEndDateInWords
            {
                get
                {
                    return Crypt.Utils.GetDateTimeInFullWordsFormat(this.LoanEndDate);
                }
            }  

            public string ContractSpecificEndDate
            {
                get 
                {
                    return Crypt.Utils.GetDateTimeInSpecialFormat(this.LoanEndDate); 
                }
            }

            public string ContractAmountInWords
            {
                get { return mContractAmountInWords; }
                set { mContractAmountInWords = value; }
            }

            public decimal ContractAmount
            {
                get { return mContractAmount; }
                set { mContractAmount = value; }
            }

            public decimal ContractAmountInLei
            {
                get { return mContractAmountInLei; }
                set { mContractAmountInLei = value; }
            }

            public string ContractAmountInLeiInWords
            {
                get { return mContractAmountInLeiInWords; }
                set { mContractAmountInLeiInWords = value; }
            }

            public decimal ContrcatPercent
            {
                get { return mContrcatPercent; }
                set { mContrcatPercent = value; }
            }

            public string ContrcatPercentInWords
            {
                get { return mContrcatPercentinWords; }
                set { mContrcatPercentinWords = value; }
            }

            public decimal ContractPenalty
            {
                get { return mContractPenalty; }
                set { mContractPenalty = value; }
            }       

            public string BankFullName
            {
                get { return mBankFullName; }
                set { mBankFullName = value; }
            }

            public string CodulBancii
            {
                get { return mCodulBancii; }
                set { mCodulBancii = value; }
            }

            public string ContBancar
            {
                get { return mContBancar; }
                set { mContBancar = value; }
            }

            public string ClientTelefon
            {
                get { return mClientTelefon; }
                set { mClientTelefon = value; }
            }

            public string ContractValutaNameInfinitivInWords
            {
                get { return mContractValutaNameInfinitivInWords; }
                set { mContractValutaNameInfinitivInWords = value; }
            }

            public string ContractValutaNameNotInfinitivInWords
            {
                get { return mContractValutaNameNotInfinitivInWords; }
                set { mContractValutaNameNotInfinitivInWords = value; }
            }

            public decimal CurrencyChangeRate
            {
                get { return mCurrencyChangeRate; }
                set { mCurrencyChangeRate = value; }
            }

            public string CurrencyChangeRateSimbols
            {
                get { return mCurrencyChangeRateSimbols; }
                set { mCurrencyChangeRateSimbols = value; }
            }

            public string LoanStateString
            {
                get { return mLoanStateString; }
                set { mLoanStateString = value; }
            }

            public int LoanState
            {
                get { return mLoanState; }
                set { mLoanState = value; }
            }

            public int FundingLineID
            {
                get { return mFundingLineID; }
                set { mFundingLineID = value; }
            }

            public string CreditFundingLine
            {
                get { return mCreditFundingLine; }
                set { mCreditFundingLine = value; }
            }

            public int NrOfCreditMonth
            {
                get { return mNrOfCreditMonth; }
                set { mNrOfCreditMonth = value; }
            }

            public int CalculatePercentFrom
            {
                get { return mCalculatePercentFrom; }
                set { mCalculatePercentFrom = value; }
            }

            public string CalculatePercentFromString
            {
                get { return mCalculatePercentFromString; }
                set { mCalculatePercentFromString = value; }
            }

            public int CalculatePenaltyFrom
            {
                get { return mCalculatePenaltyFrom; }
                set { mCalculatePenaltyFrom = value; }
            }

            public string CalculatePenaltyFromString
            {
                get { return mCalculatePenaltyFromString; }
                set { mCalculatePenaltyFromString = value; }
            }

            public int PenaltyGracePeriod
            {
                get { return mPenaltyGracePeriod; }
                set { mPenaltyGracePeriod = value; }
            }

            public string LoanScope
            {
                get { return mLoanScope; }
                set { mLoanScope = value; }
            }

            public string LoanCategoryString
            {
                get { return mLoanCategoryString; }
                set { mLoanCategoryString = value; }
            }

            public int LoanCategoryID
            {
                get { return mLoanCategoryID; }
                set { mLoanCategoryID = value; }
            }

            public int ModifiedBy
            {
                get { return mModifiedBy; }
                set { mModifiedBy = value; }
            }

            public string ModifiedByString
            {
                get { return mModifiedByString; }
                set { mModifiedByString = value; }
            }

            public string PayPeriodIDString
            {
                get { return mPayPeriodIDString; }
                set { mPayPeriodIDString = value; }
            }

            public int PayPeriodID
            {
                get { return mPayPeriodID; }
                set { mPayPeriodID = value; }
            }

            public int CurrencyID
            {
                get { return mCurrencyID; }
                set { mCurrencyID = value; }
            }

            int mLoanManagerID = 0;
            public int LoanManagerID
            {
                get { return mLoanManagerID; }
                set { mLoanManagerID = value; }
            }

            int mProductID = 0;
            public int ProductID
            {
                get { return mProductID; }
                set { mProductID = value; }
            }

            int mProgramID = 0;
            public int ProgramID
            {
                get { return mProgramID; }
                set { mProgramID = value; }
            }

            string mLoanManagerIDString = string.Empty;
            public string LoanManagerIDString
            {
                get { return mLoanManagerIDString; }
                set { mLoanManagerIDString = value; }
            }

            DateTime mrequestDate = DateTime.MinValue;
            public DateTime RequestDate
            {
                get { return mrequestDate; }
                set { mrequestDate = value; }
            }

            DateTime mContractDate = DateTime.MinValue;
            public DateTime ContractDate
            {
                get { return mContractDate; }
                set { mContractDate = value; }
            }

            DateTime mVersionDate = DateTime.MinValue;
            public DateTime VersionDate
            {
                get { return mVersionDate; }
                set { mVersionDate = value; }
            }

            public LoanObject(DataRow loanInfoRow)
            {
                if (loanInfoRow != null)
                {
                    mLoanID = (int)loanInfoRow["LoanID"];
                    mLoanVersion = (int)loanInfoRow["Version"];
                    mLoanProgramID = (int)loanInfoRow["programID"];
                    mProductID = (int)loanInfoRow["ProductID"];
                    mClientID = (int)loanInfoRow["ClientID"];

                    mLoanStartDate = (DateTime)loanInfoRow["LoanStartDate"];
                    mLoanEndDate = (DateTime)loanInfoRow["LoanEndDate"];
                    mClientFirstLastName = loanInfoRow["Client Description"].ToString();
                    mClientCountry = loanInfoRow["Client Country"] != System.DBNull.Value ? loanInfoRow["Client Country"].ToString() : string.Empty;
                    mClientRaion = loanInfoRow["Client Raion"] != System.DBNull.Value ? loanInfoRow["Client Raion"].ToString() : string.Empty;
                    mClientLocalitatea = loanInfoRow["Client Localitatea"] != System.DBNull.Value ? loanInfoRow["Client Localitatea"].ToString() : string.Empty;
                    mClientStradaAdresa = loanInfoRow["Client StradaAdresa"] != System.DBNull.Value ? loanInfoRow["Client StradaAdresa"].ToString() : string.Empty;
                    mClientBuletin = loanInfoRow["Client Buletin"] != System.DBNull.Value ? loanInfoRow["Client Buletin"].ToString() : string.Empty;
                    mBuletinEliberatDe = loanInfoRow["Client Buletin Eliberat De"] != System.DBNull.Value ? loanInfoRow["Client Buletin Eliberat De"].ToString() : string.Empty;
                    mBuletinDataEliberarii = loanInfoRow["Client data eliberarii buletin"] != System.DBNull.Value ? (DateTime)loanInfoRow["Client data eliberarii buletin"] : DateTime.MinValue;
                    mClientPersonalID = loanInfoRow["Client PersonalID"].ToString();
                    mClientBirthDate = loanInfoRow["Client BirthDate"] != System.DBNull.Value ? (DateTime)loanInfoRow["Client BirthDate"] : DateTime.MinValue;
                    mContractCode = loanInfoRow["contractCode"] != System.DBNull.Value ? (int)loanInfoRow["contractCode"] : 0;

                    mCreditFundingLine = loanInfoRow["Credit Funding Line"] != System.DBNull.Value ? loanInfoRow["Credit Funding Line"].ToString() : string.Empty;
                    mFundingLineID = (int)loanInfoRow["fundingLineID"];
                    mNrOfCreditMonth = (int)loanInfoRow["nrOfCreditMonthValue"];
                    mCalculatePercentFrom = loanInfoRow["CalculatePercentFrom"] != System.DBNull.Value ? (int)loanInfoRow["CalculatePercentFrom"] : 0;
                    mCalculatePercentFromString = loanInfoRow["calculatePercentFromString"] != System.DBNull.Value ? loanInfoRow["calculatePercentFromString"].ToString() : string.Empty;
                    mCalculatePenaltyFromString = loanInfoRow["calclatePEnaltyFromString"] != System.DBNull.Value ? loanInfoRow["calclatePEnaltyFromString"].ToString() : string.Empty;
                    mCalculatePenaltyFrom = loanInfoRow["CalculatePenaltyFrom"] != System.DBNull.Value ? (int)loanInfoRow["CalculatePenaltyFrom"] : 0;
                    mPenaltyGracePeriod = (int)loanInfoRow["penaltyGracePeriod"];
                    mLoanScope = loanInfoRow["loanScope"] != System.DBNull.Value ? loanInfoRow["loanScope"].ToString() : string.Empty;
                    mLoanCategoryID = loanInfoRow["loanCategory"] != System.DBNull.Value ? (int)loanInfoRow["loanCategory"] : 0;
                    mLoanCategoryString = loanInfoRow["loanCategoryString"] != System.DBNull.Value ? loanInfoRow["loanCategoryString"].ToString() : string.Empty;
                    mModifiedBy = loanInfoRow["modifiedBy"] != System.DBNull.Value ? (int)loanInfoRow["modifiedBy"] : 0;
                    mModifiedByString = loanInfoRow["modifiedByString"] != System.DBNull.Value ? (string)loanInfoRow["modifiedByString"] : string.Empty;
                    mPayPeriodID = loanInfoRow["payPeriodID"] != System.DBNull.Value ? (int)loanInfoRow["payPeriodID"] : 0;
                    mPayPeriodIDString = loanInfoRow["payPeriodIDString"] != System.DBNull.Value ? (string)loanInfoRow["payPeriodIDString"] : string.Empty;
                    mrequestDate = loanInfoRow["requestDate"] != System.DBNull.Value ? (DateTime)loanInfoRow["requestDate"] : DateTime.MinValue;
                    mContractDate = loanInfoRow["ContractDate"] != System.DBNull.Value ? (DateTime)loanInfoRow["ContractDate"] : DateTime.MinValue;
                    mVersionDate = loanInfoRow["VersionDate"] != System.DBNull.Value ? (DateTime)loanInfoRow["VersionDate"] : DateTime.MinValue;

                    mLoanManagerID = loanInfoRow["loanManager"] != System.DBNull.Value ? (int)loanInfoRow["loanManager"] : 0;
                    mLoanManagerIDString = loanInfoRow["LoanManagerIDString"] != System.DBNull.Value ? (string)loanInfoRow["LoanManagerIDString"] : string.Empty;
                    mProgramID = loanInfoRow["ProgramID"] != System.DBNull.Value ? (int)loanInfoRow["ProgramID"] : 0;


                    mCurrencyID = loanInfoRow["CurrencyID"] != System.DBNull.Value ? (int)loanInfoRow["CurrencyID"] : 0;
                    mContractAmount = loanInfoRow["creditAmountValue"] != System.DBNull.Value ? (decimal)loanInfoRow["creditAmountValue"] : 0;
                    mContrcatPercent = loanInfoRow["percentValue"] != System.DBNull.Value ? (decimal)loanInfoRow["percentValue"] : 0;
                    mContractPenalty = loanInfoRow["penaltyValue"] != System.DBNull.Value ? (decimal)loanInfoRow["penaltyValue"] : 0;
                    mCurrencyChangeRate = loanInfoRow["currencyChangeRate"] != System.DBNull.Value ? (decimal)loanInfoRow["currencyChangeRate"] : 0;
                    mCurrencyChangeRateSimbols = loanInfoRow["currencyID"] != System.DBNull.Value ? Crypt.Utils.GetCurrencyChangeValutaSimbols((int)Constants.Constants.CurrencyList.MDL, (int)loanInfoRow["currencyID"]) : string.Empty;


                    mContractAmountInWords = Crypt.Utils.GetSumInWord(mContractAmount, (int)Constants.Constants.Classifiers.Romanian_Language, (int)Constants.Constants.NumberWordMode.Money);
                    mContrcatPercentinWords = Crypt.Utils.GetSumInWord(mContrcatPercent, (int)Constants.Constants.Classifiers.Romanian_Language, (int)Constants.Constants.NumberWordMode.SimpleNumber);
                    mBankFullName = loanInfoRow["Client Bank Name"] != System.DBNull.Value ? loanInfoRow["Client Bank Name"].ToString() : string.Empty;
                    mCodulBancii = loanInfoRow["Client Bank IBAN"] != System.DBNull.Value ? loanInfoRow["Client Bank IBAN"].ToString() : string.Empty;
                    mContBancar = loanInfoRow["Client Contbancar"] != System.DBNull.Value ? loanInfoRow["Client Contbancar"].ToString() : string.Empty;

                    string telefonString = loanInfoRow["Client Telefon Fix"] != System.DBNull.Value && !loanInfoRow["Client Telefon Fix"].ToString().Equals(string.Empty) ? loanInfoRow["Client Telefon Fix"].ToString() : string.Empty;

                    telefonString += (!telefonString.Equals(string.Empty) ? ", " : string.Empty) + (loanInfoRow["Client Telefon Mobil"] != System.DBNull.Value && !loanInfoRow["Client Telefon Mobil"].ToString().Equals(string.Empty) ? loanInfoRow["Client Telefon Mobil"].ToString() : string.Empty);
                    telefonString += (!telefonString.Equals(string.Empty) ? ", " : string.Empty) + (loanInfoRow["Client Telefon Mobil2"] != System.DBNull.Value && !loanInfoRow["Client Telefon Mobil2"].ToString().Equals(string.Empty) ? loanInfoRow["Client Telefon Mobil2"].ToString() : string.Empty);

                    mClientTelefon = telefonString;
                    mLoanState = (int)loanInfoRow["loanState"];
                    mLoanStateString = loanInfoRow["loanState_string"] != System.DBNull.Value ? (string)loanInfoRow["loanState_string"] : string.Empty;

                    mContractAmountInLei = (decimal)loanInfoRow["Contract Amount in Lei"];
                    mContractAmountInLeiInWords = Crypt.Utils.GetSumInWord(mContractAmountInLei, (int)Constants.Constants.Classifiers.Romanian_Language, (int)Constants.Constants.NumberWordMode.Money);
                    mContractValutaNameInfinitivInWords = Crypt.Utils.GetValutaNameInWords((int)Constants.Constants.Classifiers.Romanian_Language, (int)loanInfoRow["currencyID"], true);
                    mContractValutaNameNotInfinitivInWords = Crypt.Utils.GetValutaNameInWords((int)Constants.Constants.Classifiers.Romanian_Language, (int)loanInfoRow["currencyID"], false);
                }
            }
        }

        public class Fidejusor
        {
            private int mID = 0;
            public int OrderID
            {
                get { return mID; }
                set { mID = value; }
            }

            private int mLoanID = 0;
            public int LoanIDz
            {
                get { return mLoanID; }
                set { mLoanID = value; }
            }

            private int mContractCode = 0;
            public int ContractCode
            {
                get { return mContractCode; }
                set { mContractCode = value; }
            }

            private int mFidejusorID = 0;
            public int FidejusorID
            {
                get { return mFidejusorID; }
                set { mFidejusorID = value; }
            }

            private string mFidejusortFirstLastName = string.Empty;
            public string FidejusorFirstLastName
            {
                get { return mFidejusortFirstLastName; }
                set { mFidejusortFirstLastName = value; }
            }

            private string mFidejusorIDNO = string.Empty;
            public string FidejusorIDNO
            {
                get { return mFidejusorIDNO; }
                set { mFidejusorIDNO = value; }
            }

            private DateTime mFidejusorBirthDate = DateTime.MinValue;
            public DateTime FidejusorBirthDate
            {
                get { return mFidejusorBirthDate; }
                set { mFidejusorBirthDate = value; }
            }

            private string mFullDescription = string.Empty;
            public string FidejusorFullDescription
            {
                get { return mFullDescription; }
                set { mFullDescription = value; }
            }

            string mFidejusorCountry = string.Empty;
            public string FidejusorCountry
            {
                get { return mFidejusorCountry; }
                set { mFidejusorCountry = value; }
            }

            string mFidejusorRaion = string.Empty;
            public string FidejusorRaion
            {
                get { return mFidejusorRaion; }
                set { mFidejusorRaion = value; }
            }

            string mFidejusorLocalitatea = string.Empty;
            public string FidejusorLocalitatea
            {
                get { return mFidejusorLocalitatea; }
                set { mFidejusorLocalitatea = value; }
            }

            string mFidejusorAdresa = string.Empty;
            public string FidejusorAdresa
            {
                get { return mFidejusorAdresa; }
                set { mFidejusorAdresa = value; }
            }

            DateTime mLoanStartDate = DateTime.MinValue;
            public DateTime LoanStartDate
            {
                get { return mLoanStartDate; }
                set { mLoanStartDate = value; }
            }

            DateTime mLoanEndDate = DateTime.MinValue;
            public DateTime LoanEndDate
            {
                get { return mLoanEndDate; }
                set { mLoanEndDate = value; }
            }

            public string LoanSpecificStartDate
            {
                get
                {
                    return Crypt.Utils.GetDateTimeInSpecialFormat(this.LoanStartDate);
                }
            }

            public string LoanSpecificEndDate
            {
                get
                {
                    return Crypt.Utils.GetDateTimeInSpecialFormat(this.LoanEndDate);
                }
            }

            public string LoanStartDateInWords
            {
                get
                {
                    return Crypt.Utils.GetDateTimeInFullWordsFormat(this.LoanStartDate);
                }
            }

            public string LoanEndDateInWords
            {
                get
                {
                    return Crypt.Utils.GetDateTimeInFullWordsFormat(this.LoanEndDate);
                }
            }  

            string mClientFirstLastName = string.Empty;
            public string ClientFirstLastName
            {
                get { return mClientFirstLastName; }
                set { mClientFirstLastName = value; }
            }

            string mClientIDNP = string.Empty;
            public string ClientIDNP
            {
                get { return mClientIDNP; }
                set { mClientIDNP = value; }
            }

            string mLoanAmountInWords = string.Empty;
            public string LoanAmountInWords
            {
                get { return mLoanAmountInWords; }
                set { mLoanAmountInWords = value; }
            }

            decimal mLoanAmount = 0;
            public decimal LoanAmount
            {
                get { return mLoanAmount; }
                set { mLoanAmount = value; }
            }

            public Fidejusor()
            {
            }

            public Fidejusor(DataRow fidejusorInfoRow)
            {
                if (fidejusorInfoRow != null)
                {
                    mID = fidejusorInfoRow["ID"] != System.DBNull.Value ? (int)fidejusorInfoRow["ID"] : 0;
                    mLoanID = (int)fidejusorInfoRow["LoanID"];
                    mFidejusorID = (int)fidejusorInfoRow["FidejusorID"];
                    mFidejusortFirstLastName = fidejusorInfoRow["FidejusortFirstLastName"].ToString();
                    mFidejusorBirthDate = fidejusorInfoRow["FidejusorBirthDate"] != System.DBNull.Value ? (DateTime)fidejusorInfoRow["FidejusorBirthDate"] : DateTime.MinValue;
                    mFidejusorIDNO = fidejusorInfoRow["FidejusorIDNO"] != System.DBNull.Value ? (string)fidejusorInfoRow["FidejusorIDNO"] : string.Empty;
                    mFullDescription = mID + ". " + mFidejusortFirstLastName + " (" + mFidejusorBirthDate.ToString(Constants.Constants.ISODateBackwardDotsFormat) + ")";
                    mFidejusorCountry = fidejusorInfoRow["Fidejusor Country"] != System.DBNull.Value ? (string)fidejusorInfoRow["Fidejusor Country"] : string.Empty;
                    mFidejusorRaion = fidejusorInfoRow["Fidejusor Raion"] != System.DBNull.Value ? (string)fidejusorInfoRow["Fidejusor Raion"] : string.Empty;
                    mFidejusorLocalitatea = fidejusorInfoRow["Fidejusor Localitatea"] != System.DBNull.Value ? (string)fidejusorInfoRow["Fidejusor Localitatea"] : string.Empty;
                    mLoanStartDate = fidejusorInfoRow["LoanStartDate"] != System.DBNull.Value ? (DateTime)fidejusorInfoRow["LoanStartDate"] : DateTime.MinValue;
                    mLoanEndDate = fidejusorInfoRow["LoanEndDate"] != System.DBNull.Value ? (DateTime)fidejusorInfoRow["LoanEndDate"] : DateTime.MinValue;
                    mContractCode = fidejusorInfoRow["contractCode"] != System.DBNull.Value ? (int)fidejusorInfoRow["contractCode"] : 0;
                    mClientFirstLastName = fidejusorInfoRow["ClientFirstLastName"] != System.DBNull.Value ? (string)fidejusorInfoRow["ClientFirstLastName"] : string.Empty;
                    mClientIDNP = fidejusorInfoRow["ClientIDNP"] != System.DBNull.Value ? (string)fidejusorInfoRow["ClientIDNP"] : string.Empty;
                    mLoanAmount = fidejusorInfoRow["LoanAmount"] != System.DBNull.Value ? (decimal)fidejusorInfoRow["LoanAmount"] : 0;
                    mFidejusorAdresa = fidejusorInfoRow["FidejusorAdresa"] != System.DBNull.Value ? (string)fidejusorInfoRow["FidejusorAdresa"] : string.Empty;
                    mLoanAmountInWords = Crypt.Utils.GetSumInWord(mLoanAmount, (int)Constants.Constants.Classifiers.Romanian_Language, (int)Constants.Constants.NumberWordMode.Money);
                }
            }
        }



    }
}
